--[[/**
-- * 
 * 召唤物继承主人的技能
-- *
-- */]]

---@class BuffEffect4605100 : BaseBuffEffect
BuffEffect4605100 = ClientFight.CreateClass("BuffEffect4605100", ClientFight.BaseBuffEffect)
local t = BuffEffect4605100

---@param fight Fight
---@param buff FighterBuff
function t:add(fight, buff)
    local target = buff.target;
    if (not target:isSummons()) then
        return IBuffEffect.FAIL;
    end
    local parent = target.summonsCreater;
    if (parent == null) then
        return IBuffEffect.FAIL;
    end
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    for k, skillId in pairs(buffEffectValue) do
        local b = t:containsSkillId(skillId, parent);
        if ( b) then
        --继承爸爸的技能
        SkillManager.addSkill(fight, target, skillId, 0);
        FighterManager.addPassiveSkillEffect(fight, target);
        break ;
        end
    end
    return ClientFight.BaseBuffEffect.add(self, fight, buff);
end

function t:containsSkillId(skillId, source)
    local skills = source.skills;
    for k, skill in pairs(skills) do
        if (skill.skillId == skillId) then
            return true;
        end
    end
    local passiveskills = source.passiveskills;
    for k, skill in pairs(passiveskills) do
        if (skill.skillId == skillId) then
            return true;
        end
    end
    return false;
end

t.New()